<?php

namespace App\Providers;

use Dreamcat\ConfigClient\ConfigCenterReadProcessInterface;
use Dreamcat\ConfigClient\Impl\ConfigCenterReadProcess;
use Illuminate\Support\ServiceProvider;
use Psr\Log\LoggerInterface;

/**
 * -
 * @author vijay
 */
class ConfigCenterReadProcessProvider extends ServiceProvider
{
    /** @inheritDoc */
    public function register()
    {
        $this->app
            ->bind(
                ConfigCenterReadProcessInterface::class,
                function () {
                    $obj = new ConfigCenterReadProcess(config("configCenter.versionCacheFile"));
                    $obj->setTryCount(config("configCenter.tryCount", 3))
                        ->setLogger($this->app->get(LoggerInterface::class));
                    return $obj;
                }
            );
    }
}

# end of file
